package live.jialing.sip.contact.student.repository;

import live.jialing.core.data.jpa.CustomJpaRepository;
import live.jialing.sip.contact.student.domain.StudentGroup;
import org.springframework.data.jpa.repository.Query;

/**
 * 家校通讯录的分组
 */
public interface StudentGroupRepository extends CustomJpaRepository<StudentGroup, Long> {

    /**
     * 获取组信息，包含学生信息
     *
     * @param groupId
     * @return
     */
    @Query("select g from StudentGroup g left join fetch g.students where g.id = ?1")
    StudentGroup findGroupFetchStudentByPK(long groupId);
}